package com.rzt.service;

import com.rzt.moredb.entity.DbMsg;
import com.rzt.moredb.repository.DbMsgRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;

/**
 * @author Zhao Yi
 * @version 1.0
 * @date 2020/12/20 21:31
 **/
@Service
public class DbMsgService {

    @Autowired
    private DbMsgRepository dbMsgRepository;

    /**
     * 保存实体
     * @param msg
     */
    @Transactional
    public void save(DbMsg msg) {
        dbMsgRepository.save(msg);
    }

    public DbMsg findById(String id) {
        return dbMsgRepository.findById(id).get();
    }
}
